<template>
  <div class="container">
    <div class="handle-box">
      <el-form ref="form" :model="form" label-width="120px" class="flex">
        <el-form-item label="账户名称：">
          <el-input
            v-model="select.name"
            placeholder="请输入名称"
            class="handle-input mr10"
          ></el-input>
        </el-form-item>
        <el-form-item>
          <el-button size="mini" type="primary" @click="screeningData">查 询</el-button>
        </el-form-item>
      </el-form>
    </div>
    <el-table
      highlight-current-row
      :data="
        tableData.slice((currentPage - 1) * pageSize, currentPage * pageSize)
      "
    >
      <el-table-column prop="NAME" label="账户名称"></el-table-column>
      <el-table-column prop="IP" label="账户IP"></el-table-column>
      <el-table-column prop="SETUPTIME" label="登入时间"></el-table-column>
      <el-table-column prop="CANCELTIME" label="登出时间"></el-table-column>
      <el-table-column prop="HANDLE" label="操作"></el-table-column>
    </el-table>
    <div class="pagination">
      <el-pagination
        background
        layout="total, sizes, prev, pager, next, jumper"
        :current-page="currentPage"
        :page-size="pageSize"
        :total="tableData.length"
        @size-change="handleSizeChange"
        @current-change="handlePageChange"
      ></el-pagination>
    </div>
   
  </div>
</template>
<script>

import '../../assets/css/common.css'

export default {
  data () {
    return {
      currentPage: 1, //初始页
      pageSize: 10,    //    每页的数据
      originalData: [],
      tableData: [],
      form: {},
      select: {
        name: ''
      },
    }
  },
  created () {
  },
  mounted () {
    this.getTrackUserInfoList()
  },
  methods: {
    async getTrackUserInfoList () {
      var url = '/Role/GetHandleDailyInfo'
      const { data } = await this.$Http.get(url)
      this.originalData = data
      this.screeningData()
    },
    // 模糊查询
    screeningData () {
      this.currentPage = 1
      this.tableData = this.originalData
      if (this.select.name) this.tableData = this.tableData.filter(item => item.NAME.includes(this.select.name))
    },
    change (e) {
      this.$forceUpdate()
    },
    // 分页导航
    handlePageChange (currentPage) {
      this.currentPage = currentPage;
      // this.$set(this.query, 'pageIndex', val);
      // this.getData();
    },
    handleSizeChange (size) {
      this.pageSize = size;
    },
  }
}
</script>
<style scoped>
.el-select {
  width: 100%;
  max-width: 200px;
}
.el-input {
  width: 100%;
  max-width: 200px;
}
/* .displaynone {
  display: block;
}
.displaytnone {
  display: block;
}
.displayenone {
  display: block;
}
.displayfnone {
  display: block;
} */
</style>